using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GaragerTrgiger : MonoBehaviour
{
    Garage garage;
    PlayerController player;

    private void Awake()
    {
        player = FindObjectOfType<PlayerController>();
        garage = GetComponentInParent<Garage>();
    }
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Stone" && (player.IsPushing() || player.stoneFalling))
        {
            print(player.stoneFalling);
            garage.mechanism.TriggerOn();
            other.GetComponent<CanMoveBlock>().FindStander();
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.tag == "Stone" && player.IsPushing())
        {
            garage.mechanism.TriggerOff();
        }
    }
}
